<template>
	<view>
		<cu-custom bgColor="bg-blue" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">{{title}}</block>
		</cu-custom>
		<!-- 菜单 -->
		<view class="cu-bar bg-white solid-bottom text-center" :style="[{top:CustomBar + 'px'}]"style="margin-top: -11%;">
			<view class="cu-item flex-sub" :class="0==tabIndex?'text-blue cur':''" @tap="tabSelect" data-id="0">
				表单信息
			</view>
			<view class="cu-item flex-sub" :class="2==tabIndex?'text-blue cur':''" @tap="tabSelect" data-id="2">
				流转记录
			</view>
		
		</view>
		<view v-show="0 === tabIndex">
			<scroll-view scroll-y class="page">
			<view class=" bg-white margin-top">
				<view class="cu-form-group margin-top">
					<view class="title">加分原因</view>
					<input name="input" v-model="addReason" disabled></input>
				</view>
				<view class="cu-form-group">
					<view class="title">申请时间</view>
					<input name="input" v-model="addTime" disabled></input>
				</view>
				<view class="cu-form-group">
					<view class="title">审核时间</view>
					<input name="input" v-model="auditTime" disabled></input>
				</view>
				<view class="cu-form-group">
					<view class="title">加分数</view>
					<input name="input" v-model="addPoint" disabled></input>
				</view>
				<view class="cu-form-group">
					<view class="title">审核状态</view>
					<input name="input" v-model="addState" disabled></input>
				</view>
				<view class="cu-form-group">
					<view class="title">审批人</view>
					<input name="input" v-model="approver" disabled></input>
				</view>
				<view class="cu-form-group">
					<view class="title">附件</view>
					<input name="input" v-model="notSubmitted" v-if = "addEnclosure.length < 2" disabled></input>
					<van-image lazy-load width="100" height="100" v-for="(src, indexs) in addEnclosure.split(',')"
							:key="indexs" :src="`https://suntuding.com` + src" v-if = "addEnclosure.length >= 2" />
					</van-cell-group>
				</view>
			</view>

			<view class="cu-tabbar-height"></view>
			</scroll-view>
		</view>
		<view v-show="2 === tabIndex">
			<view class="padding bg-white margin-top">
	
				<view class="cu-timeline">
					<view class="cu-time">{{addTime}}</view>
					<view class="cu-item text-blue">
						<view class="content">
							<view class="cu-capsule radius">
								<view class="cu-tag bg-cyan">审核</view>
							</view>
							
							<view class="margin-top">
								审批人 : {{approver}}
							</view>
							<view class="margin-top">
								审核状态 : {{addState}}
							</view>
							<view class="margin-top">
								申请时间 : {{addTime }}
							</view>
							<view class="margin-top" v-if="addState !== '未审核'">
								审核时间 : {{auditTime}}
							</view>
<!-- 							<view class="margin-top" v-if="addState !== '未审核'">
								用时 : {{'0秒'}}
							</view> -->
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		onLoad: function (option) {
		    this.flow = JSON.parse(decodeURIComponent(option.flow));
			this.addReason = this.flow.addReason
			this.addTime = this.flow.addTime
			this.addPoint = this.flow.addPoint
			this.addEnclosure = this.flow.addEnclosure
			this.addState = this.flow.addState
			this.approver = this.flow.approver
			this.auditTime = this.flow.auditTime
			// this.tempList1 = this.addTime.split(' ')
			// this.tempList2 = this.tempList1[0].split('-')
			// this.addYear = this.tempList2[0]
			// this.addMon = this.tempList2[1]
			// this.addDay = this.tempList2[2]
			// this.tempList2 = this.tempList1[1].split(':')
			// this.addHour = this.tempList2[0]
			// this.addmin = this.tempList2[1]
			// this.tempList1 = this.auditTime.split(' ')
			// this.tempList2 = this.tempList1[0].split('-')
			// this.auditYear = this.tempList2[0]
			// this.auditMon = this.tempList2[1]
			// this.auditDay = this.tempList2[2]
			// this.tempList2 = this.tempList1[1].split(':')
			// this.auditHour = this.tempList2[0]
			// this.auditmin = this.tempList2[1]
			
			// console.log(this.tempList)
		},
		data() {
			return {
				addEnclosure: '',
				addPoint: '',
				addReason: '',
				addState: '',
				addTime: '',
				approver: '',
				auditTime: '',
				list: [],
				id: '',
				flow: null,
				tabIndex: 0,
				form: null,
				notSubmitted: '未提交',
				// timeDifference: 0,
				// tempList1: [],
				// tempList2: [],
				// addYear: 0,
				// addMon: 0,
				// addDay: 0,
				// addHour: 0,
				// addmin: 0,
				// auditYear: 0,
				// auditMon: 0,
				// auditDay: 0,
				// auditHour: 0,
				// auditmin: 0,
				taskSelectedTab: 'frist',
				histoicFlowList: [],
				formReadOnly: false,
				formData: [],
				imgList: []
			}
		},
		methods:{
			tabSelect (e) {
				this.tabIndex = parseInt(e.currentTarget.dataset.id);
			}
		}
	}
</script>

<style>
	page {
		padding-top: 45px;
	}
	.cu-form-group .title {
		min-width: calc(4em + 40px);
	}

</style>
